package de.fhkl.thatsstroke.customview;

import java.util.UUID;

import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.Animation;
import android.widget.LinearLayout;
import de.fhkl.thatsstroke.Inbox.StrokeItemAdapter;

/**
 * Subclass of LinearLayout to get access to onAnimationEnd. Needed to react
 * properly to the end of an animation.
 */
public class ItemView extends LinearLayout
{
	private UUID mVideoId;
	private StrokeItemAdapter mAdapter;

	public ItemView(Context context)
	{
		super(context);
	}

	public ItemView(Context context, AttributeSet attrs)
	{
		super(context, attrs);
	}

	public void startAnimation(Animation animation, UUID videoId)
	{
		super.startAnimation(animation);
		mVideoId = videoId;
	}
	
	public void setAdapter(StrokeItemAdapter adapter)
	{
		mAdapter = adapter;
	}

	@Override
	protected void onAnimationEnd()
	{
		super.onAnimationEnd();
		mAdapter.removeFinished(mVideoId);
	}
}